import cv2

img = cv2.imread("D:\\xiuzhi.jpg", 0)
t1, thd = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
athdMEAN = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                 cv2.THRESH_BINARY, 5, 3)
athdGAUS = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                 cv2.THRESH_BINARY, 5, 3)
cv2.namedWindow("img", 0)
cv2.resizeWindow("img", 640, 480)
cv2.imshow("img", img)
cv2.namedWindow("thd", 0)
cv2.resizeWindow("thd", 640, 480)
cv2.imshow("thd", thd)
cv2.namedWindow("athdMEAN", 0)
cv2.resizeWindow("athdMEAN", 640, 480)
cv2.imshow("athdMEAN", athdMEAN)
cv2.namedWindow("athdGAUS", 0)
cv2.resizeWindow("athdGAUS", 640, 480)
cv2.imshow("athdGAUS", athdGAUS)
cv2.waitKey(0)
